home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / debugger / ddd-1.000 / ddd-1 / ddd-1.4b / libiberty / Makefile.in < prev    next >
Encoding:
Makefile  |  1996-01-12  |  9.0 KB  |  311 lines

  1. #
  2. # Makefile
  3. #   Copyright (C) 1990, 1991, 1992, 1995 Free Software Foundation
  4. #
  5. # This file is part of the libiberty library.
  6. # Libiberty is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU Library General Public
  8. # License as published by the Free Software Foundation; either
  9. # version 2 of the License, or (at your option) any later version.
  10. #
  11. # Libiberty is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. # Library General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU Library General Public
  17. # License along with libiberty; see the file COPYING.LIB.  If
  18. # not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. # Boston, MA 02111-1307, USA.
  20. #
  21.  
  22. # This file was written, and is maintained by K. Richard Pixley
  23. # <rich@cygnus.com>.
  24.  
  25. #
  26. # Makefile for libiberty directory
  27. #
  28.  
  29. srcdir = .
  30.  
  31. prefix = /usr/local
  32.  
  33. exec_prefix = $(prefix)
  34. bindir = $(exec_prefix)/bin
  35. libdir = $(exec_prefix)/lib
  36.  
  37. datadir = $(prefix)/lib
  38.  
  39. mandir = $(prefix)/man
  40. man1dir = $(mandir)/man1
  41. man2dir = $(mandir)/man2
  42. man3dir = $(mandir)/man3
  43. man4dir = $(mandir)/man4
  44. man5dir = $(mandir)/man5
  45. man6dir = $(mandir)/man6
  46. man7dir = $(mandir)/man7
  47. man8dir = $(mandir)/man8
  48. man9dir = $(mandir)/man9
  49. infodir = $(prefix)/info
  50. includedir = $(prefix)/include
  51. oldincludedir =
  52. docdir = $(datadir)/doc
  53.  
  54. SHELL = /bin/sh
  55.  
  56. # Multilib support variables.
  57. MULTITOP = .
  58. MULTIDIRS =
  59. MULTISUBDIR =
  60. MULTIDO = true
  61. MULTICLEAN = true
  62.  
  63. INSTALL = install -c
  64. INSTALL_PROGRAM = $(INSTALL)
  65. INSTALL_DATA = $(INSTALL)
  66.  
  67. AR = ar
  68. AR_FLAGS = rc
  69.  
  70. ERRORS_CC = $(CC)
  71. CFLAGS = -g
  72. LIBCFLAGS = $(CFLAGS)
  73. MAKEINFO = makeinfo
  74. RANLIB = ranlib
  75.  
  76. PICFLAG =
  77.  
  78. MAKEOVERRIDES =
  79.  
  80. TARGETLIB = libiberty.a
  81.  
  82. CONFIG_H = lconfig.h
  83. NEEDED_LIST = lneeded-list
  84.  
  85. # HOST_OFILES contains the list of objects that should be in the
  86. # library (in addition to the REQUIRED_OFILES and EXTRA_OFILES).
  87. # A configuration may override this with a fixed list a object files
  88. # names (hard to maintain), or some other way to generate a list.
  89. HOST_OFILES=`cat needed-list`
  90.  
  91. # Extra targets that the top-level target depends on.
  92. # Specifically, what needs to be made before HOST_OFILES can be used.
  93. # Can be empty if HOST_OFILES is just a list of file names.
  94. DO_ALSO = needed-list
  95.  
  96. # A configuration can specify extra .o files that should be included,
  97. # even if they are in libc. (Perhaps the libc version is buggy.)
  98. EXTRA_OFILES = 
  99.  
  100. # Flags to pass to a recursive make.  This is also used by xiberty.
  101. FLAGS_TO_PASS = \
  102.     "AR=$(AR)" \
  103.     "AR_FLAGS=$(AR_FLAGS)" \
  104.     "CC=$(CC)" \
  105.     "CFLAGS=$(CFLAGS)" \
  106.     "LIBCFLAGS=$(LIBCFLAGS)" \
  107.     "EXTRA_OFILES=$(EXTRA_OFILES)" \
  108.     "HDEFINES=$(HDEFINES)" \
  109.     "INCDIR=$(INCDIR)" \
  110.     "LDFLAGS=$(LDFLAGS)" \
  111.     "LOADLIBES=$(LOADLIBES)" \
  112.     "RANLIB=$(RANLIB)" \
  113.     "SHELL=$(SHELL)"
  114.  
  115. all: stamp-picdir $(TARGETLIB)
  116.     @if [ "$(RULE1)" != "not-used" ]; then \
  117.       $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all; \
  118.     else true; \
  119.     fi
  120.  
  121. .PHONY: check installcheck
  122. check installcheck:
  123.  
  124.  
  125. #### Host, target, and site specific Makefile fragments come in here.
  126. ###
  127.  
  128. INCDIR=$(srcdir)/../include
  129.  
  130. COMPILE.c = $(CC) -c $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES)
  131. .c.o:
  132.     if [ -n "$(PICFLAG)" ]; then \
  133.       $(COMPILE.c) $(PICFLAG) $< -o pic/$@; \
  134.     else true; fi
  135.     $(COMPILE.c) $<
  136.  
  137. # The default target just invokes make recursively.
  138. # However, the automatic configuration (in config/mh_default).
  139. # first causes it to figure out the objects missing in libc.
  140. info install-info clean-info dvi:
  141.  
  142. # NOTE: If you add new files to the library, add them to this list
  143. # (alphabetical), and add them to REQUIRED_OFILES or 'functions.def'.
  144. CFILES = alloca.c argv.c basename.c bcmp.c bcopy.c bzero.c \
  145.      clock.c concat.c cplus-dem.c fdmatch.c \
  146.      getcwd.c getopt.c getopt1.c getpagesize.c getruntime.c \
  147.          floatformat.c hex.c index.c insque.c \
  148.      memchr.c memcmp.c memcpy.c memmove.c memset.c \
  149.          obstack.c random.c rename.c rindex.c sigsetmask.c spaces.c \
  150.      strcasecmp.c strncasecmp.c \
  151.          strchr.c strdup.c strerror.c strrchr.c strsignal.c \
  152.          strstr.c strtod.c strtol.c strtoul.c tmpnam.c \
  153.      vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c waitpid.c \
  154.      xatexit.c xexit.c xmalloc.c
  155. # These are always included in the library.
  156. REQUIRED_OFILES = argv.o basename.o concat.o cplus-dem.o fdmatch.o \
  157.   getopt.o getopt1.o getruntime.o hex.o \
  158.   floatformat.o obstack.o spaces.o strerror.o strsignal.o \
  159.   vasprintf.o xatexit.o xexit.o xmalloc.o 
  160.  
  161. # Do we want/need any config overrides?
  162. #     
  163.  
  164. STAGESTUFF = $(TARGETLIB) *.o
  165.  
  166. INSTALL_DEST = libdir
  167. install: install_to_$(INSTALL_DEST)
  168.  
  169. install_to_libdir: all
  170.     $(INSTALL_DATA) $(TARGETLIB) $(libdir)/$(TARGETLIB).n
  171.     ( cd $(libdir) ; $(RANLIB) $(libdir)/$(TARGETLIB).n )
  172.     mv -f $(libdir)/$(TARGETLIB).n $(libdir)/$(TARGETLIB)
  173.  
  174. install_to_tooldir: all
  175.     $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib/$(TARGETLIB).n
  176.     ( cd $(tooldir) ; $(RANLIB) $(tooldir)/lib/$(TARGETLIB).n )
  177.     mv -f $(tooldir)/lib/$(TARGETLIB).n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
  178.     @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
  179.  
  180. # The default configuration adds to libiberty all those functions that are
  181. # missing in libc.  More precisely, it includes whatever $(CC) fails to find.
  182. # Then a sed+awk combination translates the ld error messages into
  183. # a list of .o files.
  184.  
  185. needed-list: stamp-picdir $(NEEDED_LIST)
  186.     cp $(NEEDED_LIST) needed-list
  187.  
  188. lneeded-list: $(EXTRA_OFILES) needed.awk errors
  189.     rm -f lneeded-list
  190.     f=""; \
  191.     for i in `awk -f needed.awk <errors` $(EXTRA_OFILES) ; do \
  192.       case " $$f " in \
  193.         *" $$i "*) ;; \
  194.         *) f="$$f $$i" ;; \
  195.       esac ; \
  196.     done ; \
  197.     echo $$f >>lneeded-list
  198.  
  199. # Generate an awk script that looks for functions in functions.def
  200.  
  201. needed.awk: $(srcdir)/functions.def Makefile
  202.     echo "# !Automatically generated from $(srcdir)/functions.def"\
  203.       "- DO NOT EDIT!" >needed.awk
  204.     grep '^DEF(' < $(srcdir)/functions.def \
  205.         | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.o " }|' \
  206.         >>needed.awk
  207.  
  208. config.h: $(CONFIG_H)
  209.     cp $(CONFIG_H) config.h
  210.  
  211. lconfig.h: needed2.awk errors
  212.     echo "/* !Automatically generated from $(srcdir)/functions.def"\
  213.       "- DO NOT EDIT! */" >lconfig.h
  214.     awk -f needed2.awk <errors >>lconfig.h
  215.  
  216. # Generate an awk script that looks for variables in functions.def
  217.  
  218. needed2.awk: $(srcdir)/functions.def Makefile
  219.     echo "# !Automatically generated from $(srcdir)/functions.def"\
  220.       "- DO NOT EDIT!" >needed2.awk
  221.     grep '^DEFVAR(' < $(srcdir)/functions.def \
  222.      | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
  223.      >>needed2.awk
  224.     grep '^DEFFUNC(' < $(srcdir)/functions.def \
  225.      | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
  226.      >>needed2.awk
  227.  
  228. dummy.o: $(srcdir)/dummy.c $(srcdir)/functions.def
  229.     $(CC) -c $(CFLAGS) -I. -I$(INCDIR) $(HDEFINES) $(srcdir)/dummy.c 2>/dev/null
  230.  
  231. errors: dummy.o $(EXTRA_OFILES)
  232.     -($(ERRORS_CC) -o dummy $(CFLAGS) $(LDFLAGS) $(ERRORS_LDFLAGS) dummy.o $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true
  233.  
  234. $(HOST_OFILES) $(REQUIRED_OFILES) : config.h
  235.  
  236. RULE1 = $(TARGETLIB)
  237. $(RULE1): $(REQUIRED_OFILES) $(DO_ALSO) .always.
  238.     @$(MAKE) RULE1=not-used RULE2=$(TARGETLIB) $(FLAGS_TO_PASS) \
  239.         "HOST_OFILES=$(HOST_OFILES)"
  240.  
  241. # Rule invoked by recursive make in $(RULE1).
  242. RULE2 = not-used
  243. $(RULE2): $(REQUIRED_OFILES) $(HOST_OFILES)
  244.     rm -rf $(TARGETLIB)
  245.     $(AR) $(AR_FLAGS) $(TARGETLIB) \
  246.       $(REQUIRED_OFILES) $(HOST_OFILES)
  247.     $(RANLIB) $(TARGETLIB)
  248.  
  249. stamp-picdir:
  250.     if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \
  251.       mkdir pic; \
  252.     else true; fi
  253.     touch stamp-picdir
  254.  
  255. .always.:
  256. # Do nothing.
  257.  
  258. .PHONY: all etags tags ls clean stage1 stage2 .always.
  259.  
  260. etags tags: TAGS
  261.  
  262. TAGS: $(CFILES) $(HFILES)
  263.     etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done`
  264.  
  265. # The standalone demangler (c++filt) has been moved to binutils.
  266. demangle:
  267.     @echo "The standalone demangler, now named c++filt, is now"
  268.     @echo "a part of binutils."
  269.     @false
  270.  
  271. ls:
  272.     @echo Makefile $(HFILES) $(CFILES)
  273.  
  274. # Need to deal with profiled libraries, too.
  275.  
  276. mostlyclean:
  277.     rm -rf *.o pic core errs \#* *.E a.out
  278.     rm -f needed.awk needed2.awk errors dummy needed-list config.h
  279.     rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
  280.     @$(MULTICLEAN) multi-clean DO=mostlyclean
  281. clean: mostlyclean
  282.     rm -f *.a
  283.     @$(MULTICLEAN) multi-clean DO=clean
  284. distclean: clean
  285.     rm -f *~ Makefile config.status alloca-conf.h xhost-mkfrag TAGS
  286.     @$(MULTICLEAN) multi-clean DO=distclean
  287. realclean: distclean
  288.  
  289. force:
  290.  
  291. Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
  292.     $(SHELL) ./config.status
  293.  
  294. argv.o: $(INCDIR)/libiberty.h
  295. basename.o: $(INCDIR)/libiberty.h
  296. concat.o: $(INCDIR)/libiberty.h
  297. cplus-dem.o: $(INCDIR)/demangle.h
  298. fdmatch.o: $(INCDIR)/libiberty.h
  299. getopt.o: $(INCDIR)/getopt.h
  300. getopt1.o: $(INCDIR)/getopt.h
  301. getruntime.o: $(INCDIR)/libiberty.h
  302. hex.o: $(INCDIR)/libiberty.h
  303. floatformat.o: $(INCDIR)/floatformat.h
  304. obstack.o: $(INCDIR)/obstack.h
  305. spaces.o: $(INCDIR)/libiberty.h
  306. strerror.o: $(INCDIR)/libiberty.h
  307. strsignal.o: $(INCDIR)/libiberty.h
  308. xatexit.o: $(INCDIR)/libiberty.h
  309. xexit.o: $(INCDIR)/libiberty.h
  310. xmalloc.o: $(INCDIR)/libiberty.h
  311.